package com.ruoyi.project.system.picture.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.support.Convert;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.system.picture.domain.Picture;
import com.ruoyi.project.system.picture.mapper.PictureMapper;
import com.ruoyi.project.system.user.domain.User;

@Service
public class PictureServiceImpl implements IPictureService{
	@Autowired
	private PictureMapper pictureMapper;
	
	@Override
	public Picture selectPicture(Long pictureId) {
		// TODO Auto-generated method stub
		return pictureMapper.selectPicture(pictureId);
	}
	@Override
	public List<Picture> selectPictureAll() {
		// TODO Auto-generated method stub
		return pictureMapper.selectPictureAll();
	}
	public int savePicture(Picture picture){
		picture.setCreateBy(ShiroUtils.getLoginName());
		return pictureMapper.savePicture(picture);
	}
	@Override
	public Picture selectPictureRandom(User user) {
		// TODO Auto-generated method stub
		return pictureMapper.selectPictureRandom(user);
	}
	@Override
	public List<Picture> selectPictures(List<Long> ids) {
		// TODO Auto-generated method stub
		return pictureMapper.selectPictures(ids);
	}
	@Override
	public int deletePictureById(String ids) {
		// TODO Auto-generated method stub
		return pictureMapper.deletePictureById(Convert.toStrArray(ids));
	}
	@Override
	public int updatePicture(Picture picture) {
		// TODO Auto-generated method stub
		return pictureMapper.updatePicture(picture);
	}
	@Override
	public List<Picture> selectPictureHasLabel() {
		// TODO Auto-generated method stub
		return pictureMapper.selectPictureHasLabel();
	}
	
}
